package  
{
	import org.flixel.*;
	/**
	 * ...
	 * @author morgan
	 */
	public class ScoreParticle extends FlxText
	{
		
		public function ScoreParticle() 
		{
			super(0, 0, 80, "", true);
			exists = false;
			blend = "overlay";
			setFormat("visitor", 20, 0xffffff, "center");
		}
		
		public function spawn(x:int, y:int, amount:int):void
		{
			text = "+" + Math.max(amount, 1).toString();
			
			this.x = x + Math.random() * 20 - 10;
			this.y = y + Math.random() * 20 - 10;
			this.velocity.y = -60;
			this.acceleration.y = 100;
			this.alpha = 1.0;
			this.exists = true;
		}
		
		override public function update():void 
		{
			alpha -= FlxG.elapsed;
			if (alpha <= 0) { exists = false; }
			super.update();
		}
		
	}

}